#!/usr/bin/env python
import sys
from subprocess import check_call
from shutil import rmtree
from os import path

from igor.tools import publish

git_repository = sys.argv[1]

tmp_path = "/tmp/igor.git"

if path.exists(tmp_path):
    rmtree(tmp_path)

cmd = ["git", "clone", "-q", "--depth", "1", git_repository, tmp_path]
check_call(cmd)

publish(tmp_path)
rmtree(tmp_path)
